<?php

namespace common\models\notice;

use Yii;

/**
 * This is the model class for table "{{%notice_need}}".
 *
 * @property int $id
 * @property int $notice_id 通告ID
 * @property int $role_id 需求角色ID
 * @property string $mark 备注
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class NoticeNeed extends \common\db\ActiveRecord {

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%notice_need}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['notice_id', 'role_id', 'status', 'created_at', 'updated_at'], 'integer'],
            [['mark'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'notice_id' => '通告ID',
            'role_id' => '需求角色ID',
            'mark' => '备注',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }

    public function getNotice() {
        return $this->hasOne(Notice::class, ['id' => 'notice_id']);
    }

    public function getRole() {
        return $this->hasOne(ShowbizRole::class, ['id' => 'role_id']);
    }

}
